Microservice architecture (MSA) has become more and more popular in the information technology (IT) industry (e.g., as a feature of cloud native applications). MSA brings some advantages, such as easy deployment, automatic scaling, service resilience, and so on. But it also brings some challenges. For example, in a traditional software development process, such as one involving a monolithic architecture, integration testing is an important phase to ensure software quality. But, in MSA, integration testing has some problems, including being slow, easy to break, hard to fix, and so on.
Consumer-driven contract (CDC) testing is an option for replacing integration testing in MSA. CDC testing in MSA may be separated into two categories. One category is for synchronous communications, such as for services using Hypertext Transfer Protocol (HTTP) and Representational State Transfer (REST)ful APIs. Another is asynchronous communications, such as for services using Advanced Message Queuing Protocol (AMQP), which is supported in many cloud environments. Third-party CDC tools, such as Pact, may be used for testing synchronous message contracts. However, such third-party tools are often ineffective or inefficient for testing asynchronous message contracts. For example, third-party tools may merely run a unit test to get a result and then check the result against the message contract. For complex services, such as microservices running in a cloud-based enterprise resource planning (ERP) environment, third-party CDC testing tools typically generate and use fake code (e.g., test doubles); thus, their results may not match results from code deployed on a real system.